<?php
$app = Blyn::app()->getActiveApp();
$messageList = array();
if ($eventId > 0) {
    $event = new BWEvent($eventId);
    $messageList = $event->getMessageManager()->getMessageList();
}
//Blyn::app()->getUIManager()->getCurrentScreen()->addContextVariable('eventId', $eventId);
//Blyn::app()->getUIManager()->getCurrentScreen()->addContextVariable('MmessageId', $MmessageId);
//
?>
<script type="text/javascript">
    $(document).ready(function() {
        $("#selectAll").click(function() {
            if ($(this).attr("checked") == "checked") {
                $(":checkbox").attr("checked", true);
            } else {
                $(":checkbox").attr("checked", false);
            }
        });

    });
</script> 
<?php
$form = $this->beginWidget('CActiveForm', array(
    "id" => "note-form",
    'enableAjaxValidation' => FALSE,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
?>
<legend>
    <h4><?php echo $control->getAjaxLink(array('name' => '活动列表', 'id' => 'showEventList')); ?>\
        <?php
        echo $control->getAjaxLink(array('name' => '活动内容', 'id' => 'showAddEvent'), array(
            'eventId' => $eventId));
        ?>\
        旅游攻略列表
    </h4>
</legend>

<table class="table table-hover">
    <thead>
        <tr>
            <th>
                <input type="checkbox"  id="selectAll"> 
            </th>
            <th><?php echo '名称'; ?></th>
            <th><?php echo '操作'; ?></th>
        </tr> 
    </thead>
    <fieldset>
        <tbody>
            <?php foreach ($messageList as $message) { ?>
                <tr>
                    <td><label class="checkbox">
                            <input type="checkbox" name="checkbox[]" value="<?php echo $message->id; ?>"> 
                        </label></td>
                    <td> <?php echo $message->getName(); ?> </td>     
                    <td>
                        <div class="row-fluid">                         
                            <?php
                            echo $control->getAjaxLink(array('name' => '编辑', 'id' => 'showAddNote'), array(
                                'eventId' => $eventId,
                                'messageId' => $message->getId(),
                                //'ajaxContainerId' => 'myModal',
                                'htmlOptions' => array(
                                    'enctype' => 'multipart/form-data'),
                                    //'ajaxOptions' => array(
                                    //'complete' => 'function(){$("#ajax-loaderdiv").hide();$("#myModal").modal("show");}')
                            ));
                            ?>                             
                        </div>                      
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </fieldset>
</table>

<div class="row-fluid">
    <?php
    echo $control->getAjaxLink(array('name' => '新建景点', 'id' => 'showAddNote'), array(
        'eventId' => $eventId,
        'messageId' => 0,
        //'ajaxContainerId' => 'myModal',
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data',
            'class' => 'btn'),
            //'ajaxOptions' => array(
            //'complete' => 'function(){$("#ajax-loaderdiv").hide();$("#myModal").modal("show");}')
    ));
    ?>
    <?php
    echo $control->getAjaxLink(array('name' => '删除', 'id' => 'deleteBookable'), array(
        'htmlOptions' => array(
            'class' => 'btn',
            'enctype' => 'multipart/form-data')));
    ?>
</div>   

<div><input type="hidden" name="curPageNo" value="1"></div>

<div class="pagination">  
    <ul>  
        <li class="active">
            <a href="javascript:void()">前一页</a>    </li>  
        <li class="active">
            <a href="javascript:void()">1</a>    </li>  
        <li class="active">
            <a href="javascript:void()">后一页</a>    </li>  
    </ul>  
</div>
<?php $this->endWidget(); ?>


